#ifndef __HTTP_H
#define __HTTP_H

#include <types.h>
#include <Address.h>
#include <HTTPMessage.h>
#include <HTTPMessageResponse.h>
#include <SocketTCP.h>

#define HTTP_VERSION_1_0  0
#define HTTP_VERSION_1_1  1

#define HTTP_CONNECTION_CLOSED       0
#define HTTP_CONNECTION_ESTABLISHED  1

class HTTP
{
protected:
    int status;
    Address *addr;
    SocketTCP *stcp;
    
 public:
    HTTP(Address *addr);    
    ~HTTP();

    void connect();
    static void urlencode(char *orig, char *dest, int bufsize);
    int sendMessage(HTTPMessage *msg);
    int recvMessage(HTTPMessageResponse *msg);
};

#endif
